<div class="layui-fluid layui-anim website-anim-up" id="website-class-solicit-add" lay-title="选题新增">
    <div class="layui-row layui-col-space8 website-container">
        <div class="layui-col-md10 layui-col-sm10 layui-col-xs10">
            <form class="layui-form" lay-filter="class-apply-add-solicit" id="class-apply-add-solicit">
                <div class="layui-card" id="client-user-info">
                    <div class="layui-card-header">基本信息</div>
                    <div class="layui-card-body layui-form-item">
                        <div class="layui-row">
                            <!-- 基本信息-->
                            <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                                <label class="layui-form-label website-form-item-require">征集公告名称</label>
                                <div class="layui-input-block">
                                    <select name="noticeId" lay-verify="required"
                                            lay-filter="noticeId">
                                        <option value="">请选择</option>
                                        <option
                                                th:each="item : ${noticeList}"
                                                th:value="${item.noticeId}" th:text="${item.title}">
                                        </option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6">
                                <label class="layui-form-label website-form-item-require">建议课题名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="topicName" lay-verify="required" autocomplete="off"
                                           maxlength="50" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                                <label class="layui-form-label website-form-item-require">学科分类</label>
                                <div class="layui-input-block">
                                    <select name="subjectTypeCodes"
                                            lay-verify="required"
                                            xm-select-direction="down"
                                            xm-select="subjectTypeCodes"
                                            xm-select-skin="default">
                                        <option value="">请选择</option>
                                        <option
                                                th:each="item : ${subjectTypeCode}"
                                                th:value="${item.code}" th:text="${item.name}">
                                        </option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                                <label class="layui-form-label website-form-item-require">建议人姓名</label>
                                <div class="layui-input-block">
                                    <input type="text" lay-verify="required" name="userName" autocomplete="off"
                                           maxlength="50"
                                           class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6">
                                <label class="layui-form-label website-form-item-require">建议单位</label>
                                <div class="layui-input-block">
                                    <input type="text" lay-verify="required" name="unitName" autocomplete="off"
                                           maxlength="50"
                                           class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                                <label class="layui-form-label">行政职务</label>
                                <div class="layui-input-block">
                                    <select name="position" lay-filter="positionTypeCode">
                                        <option value="">请选择</option>
                                        <option
                                                th:each="item : ${positionTypeCode}"
                                                th:value="${item.code}" th:text="${item.name}">
                                        </option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                                <label class="layui-form-label">职称级别</label>
                                <div class="layui-input-block">
                                    <select name="academic" lay-filter="titleTypeCode">
                                        <option value="">请选择</option>
                                        <option
                                                th:each="item : ${titleTypeCode}"
                                                th:value="${item.code}" th:text="${item.name}">
                                        </option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                                <label class="layui-form-label website-form-item-require">职称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="professionCode" lay-verify="required" autocomplete="off"
                                           maxlength="50" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                                <label class="layui-form-label website-form-item-require">手机</label>
                                <div class="layui-input-block">
                                    <input type="text" lay-verify="required|phone" name="mobile" autocomplete="off"
                                           maxlength="50"
                                           class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline layui-col-xs6 layui-col-sm6 layui-col-md6 ">
                                <label class="layui-form-label layui-form-label">座机</label>
                                <div class="layui-input-block">
                                    <input type="text" name="phone" lay-verify="tellphone" autocomplete="off"
                                           maxlength="50"
                                           class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline layui-col-xs12 layui-col-sm12 layui-col-md12">
                                <label class="layui-form-label website-form-item-require">建议立项依据摘要</label>
                                <div class="layui-input-block">
                                <textarea class="layui-textarea" lay-verify="required" name="proveContent"
                                          maxlength="500"
                                          placeholder="请输入内容，限制 500 字"
                                          autocomplete="off"></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="layui-card-footer">
                            <button class="layui-btn" lay-submit="" lay-filter="class-apply-add-solicit-submit"
                                    id="submit">保存
                            </button>
                            <button class="layui-btn" id="reset">返回</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script data-th-inline="none" type="text/javascript">
    layui.use(['dropdown', 'jquery', 'laydate', 'form', 'website', 'formSelects', 'validate'], function () {
        let $ = layui.jquery,
            laydate = layui.laydate,
            validate = layui.validate,
            website = layui.website,
            form = layui.form,
            formSelects = layui.formSelects,
            view = layui.view,

            $form = $('#class-apply-add-solicit'),
            $view = $('#website-class-apply-add'),
            $submit = $('#submit'),
            $reset = $('#reset')

        ;


        // 重新渲染 form否则不会显示下拉框
        form.render();
        formSelects.render();
        form.verify(validate);

        form.on('submit(class-apply-add-solicit-submit)', function () {
            let params = $form.serializeJson();
            website.post(ctx + 'topicSelect/add', params, function () {
                //  关闭当前页面

                $('#website-home').find('#query').click();
                let currentUrl = window.location.hash.replace('#', '');
                website.view.tab.del(currentUrl);
                window.location.reload();
            });
            return false;
        })

        $reset.on('click', function () {
            let currentUrl = window.location.hash.replace('#', '');
            website.view.tab.del(currentUrl);
            window.location.reload();
        })

    })


</script>